package jdbc;

import jdbc.utill.DButil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class JdbcDemo11 {
    public static void main(String[] args) throws Exception {
        Connection connection =     DButil.getConnection();
        String sql ="select count(*) sumStu from student where job =?";
        PreparedStatement ps = connection.prepareStatement(sql);
        ps.setString(1,"大队长");
        ResultSet resultSet = ps.executeQuery();
        while (resultSet.next()){
            int count=resultSet.getInt("sumStu");
            System.out.println(count);
        }
    }
}
